import numpy as np
from PIL import Image
a = np.array(Image.open('cat.png'))
print(a.shape,a.dtype,a[100,100])
#上下颠倒
Image.fromarray(a[::-1]).save('cat5.png')
#左右交换
Image.fromarray(a[:, ::-1]).save('cat6.png')
#水平组合
Image.fromarray(np.hstack((a,a))).save('cat7.png')
#垂直组合
Image.fromarray(np.vstack((a,a))).save('cat8.png')
